home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d12 / ntbiodoc.arc / NETBIOS.DOC < prev   
Text File  |  1989-06-26  |  83KB  |  2,839 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.  
  9.  
  10.  
  11.  
  12.  
  13.  
  14.  
  15.  
  16.         ##    ##  ####### ########      ######   ####    ##      ######
  17.         ###   ##  ##         ##         ##   ##   ##   ##  ##   ##    ##
  18.         ####  ##  ##         ##         ##   ##   ##  ##    ##  ##      
  19.         ## ## ##  #####      ##         ######    ##  ##    ##   ###### 
  20.         ##  ####  ##         ##         ##   ##   ##  ##    ##        ##
  21.         ##   ###  ##         ##         ##   ##   ##   ##  ##    ##   ##
  22.         ##    ##  #######    ##         ######   ####    ##       ##### 
  23.  
  24.  
  25.  
  26.                                   CBIS Net Bios
  27.                              Programmer's Reference
  28.  
  29.  
  30.  
  31.  
  32.  
  33.  
  34.  
  35.                                  by Tom Thompson
  36.  
  37.                                    April 1988
  38.  
  39.  
  40.  
  41.  
  42.  
  43.  
  44.  
  45.  
  46.                                     CBIS,Inc.
  47.                          5875 Peachtree Industrial Blvd.
  48.                               Bldg. 100  Suite 170
  49.                                Norcross, GA  30092
  50.  
  51.  
  52.  
  53.  
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.  
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70.  
  71.         Copyright (c) 1988 by CBIS, Inc.  All rights reserved.  No part 
  72.         of this publication may be reproduced without the prior written 
  73.         permission of CBIS, Inc., P.O. Box 921206, Norcross, GA 30092.
  74.  
  75.         CBIS, Inc. makes no representations or warranties with respect to 
  76.         the contents hereof and specifically disclaims any warranties 
  77.         either expressed or implied of merchantability or fitness for any 
  78.         particular purpose.  CBIS, Inc. reserves the right to change this 
  79.         publication and the software programs to which it relates with no 
  80.         obligation to notify any person or organization of such changes.
  81.  
  82.  
  83.  
  84.  
  85.  
  86.  
  87.  
  88.  
  89.  
  90.  
  91.  
  92.  
  93.  
  94.  
  95.  
  96.  
  97.  
  98.  
  99.  
  100.  
  101.  
  102.  
  103.  
  104.  
  105.  
  106.  
  107.  
  108.  
  109.  
  110.  
  111.  
  112.  
  113.  
  114.  
  115.  
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122.  
  123.  
  124.  
  125.  
  126.  
  127.                                       ii
  128.  
  129.  
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136.         Abstract
  137.  
  138.  
  139.         Net BIOS is a software interface between computer programs and a 
  140.         Local Area Network Adapter (LANA), or "LAN card".  It is used in 
  141.         Local Area Network (LAN) systems consisting of IBM compatible 
  142.         microcomputers.  The components of a LAN are the computers, each 
  143.         containing a LAN card, the interconnect cables, and the Net BIOS 
  144.         software.  Net BIOS has been implemented for a variety of LAN 
  145.         card types.  These include Token Ring, Ethernet and ARCNET.  
  146.         Application programs on different computers can communicate by 
  147.         using Net BIOS services to send and receive messages.
  148.  
  149.         The purpose of the Net BIOS is to isolate the application program 
  150.         from the actual type of hardware used in the LAN.  It also spares 
  151.         the application programmer the details of network error recovery 
  152.         and low level message addressing or routing.
  153.  
  154.         In a Net BIOS implementation of a LAN, the computers on the 
  155.         system are known by names.  Each computer has a permanent name 
  156.         that is programmed onto the LAN card.  Computers on the system 
  157.         can also be known by names designated by the programmer.  The 
  158.         commands available in Net BIOS include commands to add and delete 
  159.         names.
  160.  
  161.         Computers on a Net BIOS implementation of a LAN can communicate 
  162.         either by establishing a session or by using datagram or 
  163.         broadcast methods.  Sessions allow a larger message to be sent 
  164.         and handle error detection and recovery but they only allow 
  165.         computers to communicate on a one-to-one basis.  Datagram 
  166.         and broadcast methods allow one computer to communicate with 
  167.         several other computers at the same time, but are limited in 
  168.         message size.  Datagram and broadcast methods of communication do 
  169.         no handle error detection and recovery.  Net BIOS session control 
  170.         commands and session data transfer commands allow communication 
  171.         through sessions.  Net BIOS datagram commands allow communication 
  172.         without the use of sessions.  
  173.  
  174.         All commands are presented to the Net BIOS in a format called 
  175.         Network Control Blocks (NCB).  These blocks are allocated in 
  176.         memory by the user program.  The user program is also responsible 
  177.         for setting the neccessary input fields of the NCB and 
  178.         initializing the fields not used to zeros.  Several fields in the 
  179.         NCB are reserved for output from Net BIOS upon completion of a 
  180.         command.
  181.  
  182.         This manual discusses names and data communication methods in a 
  183.         Net BIOS implementation of a LAN.  Discussions of NCBs and Net 
  184.         BIOS commands include descriptions of all the fields in an NCB and 
  185.         all Net BIOS commands.  Each Net BIOS command description lists 
  186.         the NCB fields that are used for input or output for that 
  187.         command.  NCB and command information is summarized in the 
  188.         Appendices at the end of the manual.
  189.  
  190.  
  191.  
  192.  
  193.                                        iii
  194.  
  195.  
  196.  
  197.  
  198.  
  199.  
  200.  
  201.  
  202.                                 TABLE OF CONTENTS
  203.  
  204.  
  205.  
  206.              Introduction . . . . . . . . . . . . . . . . . .  1
  207.  
  208.              Chapter 1                      
  209.                   General Information . . . . . . . . . . . .  2
  210.                        Net BIOS Names . . . . . . . . . . . .  2
  211.                        Types of Data Transfer . . . . . . . .  3
  212.                        Data Transfer Example  . . . . . . . .  3
  213.                        Calling Net BIOS . . . . . . . . . . .  3
  214.                        Net BIOS Command Modes . . . . . . . .  4
  215.  
  216.              Chapter 2
  217.                   Communication with Net BIOS . . . . . . . .  5
  218.                        Wait Mode  . . . . . . . . . . . . . .  5
  219.                        No-Wait Polling Mode . . . . . . . . .  5
  220.                        No-Wait with Post Mode . . . . . . . .  6
  221.  
  222.              Chapter 3
  223.                   Network Control Block Format  . . . . . . .  7
  224.                   Assembly Language NCB Structure . . . . . .  9
  225.  
  226.              Chapter 4
  227.                   Net BIOS Commands . . . . . . . . . . . . . 10
  228.                        General Commands . . . . . . . . . . . 11
  229.                             Reset Command . . . . . . . . . . 11
  230.                             Cancel Command  . . . . . . . . . 12
  231.                             Adapter Status Command  . . . . . 13
  232.                             Unlink Command  . . . . . . . . . 16
  233.                        Name Commands  . . . . . . . . . . . . 17
  234.                             Add Name Command  . . . . . . . . 17
  235.                             Add Group Name Command  . . . . . 18
  236.                             Delete Name Command . . . . . . . 19
  237.                        Session Control Commands . . . . . . . 20
  238.                             Call Command  . . . . . . . . . . 20
  239.                             Listen Command  . . . . . . . . . 21
  240.                             Hangup Command  . . . . . . . . . 22
  241.                             Session Status Command  . . . . . 23
  242.                        Session Data Transfer Command  . . . . 25
  243.                             Send Command . .  . . . . . . . . 26
  244.                             Chain Send Command  . . . . . . . 27
  245.                             Receive Command . . . . . . . . . 28
  246.                             Receive Any Command . . . . . . . 29
  247.                        Datagram Commands  . . . . . . . . . . 30
  248.                             Send Datagram Command . . . . . . 30
  249.                             Receive Datagram Command  . . . . 31
  250.                             Send Broadcast Command  . . . . . 32
  251.                             Receive Broadcast Command . . . . 33
  252.  
  253.  
  254.  
  255.  
  256.  
  257.  
  258.  
  259.                                        iv
  260.  
  261.  
  262.  
  263.  
  264.  
  265.  
  266.  
  267.  
  268.                                 TABLE OF CONTENTS (Cont.)
  269.  
  270.  
  271.  
  272.  
  273.              Appendix A
  274.                   Net BIOS Command Summary . . . . . . . . . A-1
  275.  
  276.              Appendix B
  277.                   Net BIOS Control Block Format  . . . . . . B-1
  278.                   NCB Field Input/Output Summary . . . . . . B-2
  279.  
  280.              Appendix C
  281.                   Net BIOS Error Code Listing  . . . . . . . C-1
  282.  
  283.  
  284.  
  285.              List of Tables
  286.  
  287.                   1 - Adapter Status Result Buffer . . . . . . 14
  288.                   2 - Session Status Result Buffer . . . . . . 24
  289.  
  290.  
  291.  
  292.  
  293.  
  294.  
  295.  
  296.  
  297.  
  298.  
  299.  
  300.  
  301.  
  302.  
  303.  
  304.  
  305.  
  306.  
  307.  
  308.  
  309.  
  310.  
  311.  
  312.  
  313.  
  314.  
  315.  
  316.  
  317.  
  318.  
  319.  
  320.  
  321.  
  322.  
  323.  
  324.  
  325.                                        v
  326.  
  327.  
  328.  
  329.  
  330.  
  331.  
  332.  
  333.  
  334.         Introduction
  335.  
  336.         This manual describes the commands and command formats that are 
  337.         used in the Net BIOS software interface.  Net BIOS is an 
  338.         interface standard for computer to computer communication in a 
  339.         Local Area Network.  The manual assumes the reader is familiar 
  340.         with 8086 Assembly language, however, no prior experience with 
  341.         Net BIOS is required. 
  342.  
  343.         Chapter 1 gives a general overview of Net BIOS concepts.  It 
  344.         defines and states the purpose of Net BIOS.  Computers in a Net 
  345.         BIOS implementation are known on a Local Area Network by names.  
  346.         This section explains the concepts concerning names.  Computers 
  347.         on a network communicate by session or by datagram methods.  
  348.         The advantages of each of these methods of communication are 
  349.         discussed.  This chapter includes a list of the steps that must 
  350.         be taken in order for two computers to communicate through a 
  351.         session.  Use of Net BIOS through the Network Control Block 
  352.         format and the concept of wait and no-wait command modes is 
  353.         introduced.
  354.  
  355.         Chapter 2 gives more detailed information about wait and no 
  356.         wait command modes and lists the general steps necessary to pass 
  357.         a Net BIOS command from a user program to Net BIOS for 
  358.         execution.
  359.  
  360.         Chapter 3 lists and describes the 14 fields in a Network Control 
  361.         Block.  This chapter includes an example of an assembly language 
  362.         NCB structure.
  363.  
  364.         Chapter 4 describes each of the available Net BIOS commands in 
  365.         detail and lists the Network Control Blocks that are used for 
  366.         each command.  Each command description specifies which fields 
  367.         must be set by the user program and which fields are returned by 
  368.         Net BIOS after execution of the command.
  369.  
  370.         Finally, Appendices A and B include tabular summaries of the 
  371.         information presented in the text concerning Net BIOS commands and 
  372.         Network Control Blocks.  
  373.  
  374.         Appendix C contains a listing of the error codes that may be 
  375.         encountered while using the Net BIOS. 
  376.  
  377.  
  378.  
  379.  
  380.  
  381.  
  382.  
  383.  
  384.  
  385.  
  386.  
  387.  
  388.  
  389.  
  390.  
  391.                                        1
  392.  
  393.  
  394.  
  395.  
  396.  
  397.  
  398.  
  399.  
  400.         Chapter 1    General Information
  401.  
  402.         Net BIOS is a software interface between computer programs and a 
  403.         Local Area Network Adapter (LANA), or "LAN card".  It is used in 
  404.         Local Area Network (LAN) systems consisting of IBM compatible 
  405.         microcomputers.  The components of a LAN are the computers, each 
  406.         containing a LAN card, the interconnect cables, and the Net BIOS 
  407.         software.  Net BIOS has been implemented for a variety of LAN 
  408.         card types.  These include Token Ring, Ethernet and ARCNET.  
  409.         Application programs on different computers can communicate by 
  410.         using Net BIOS services to send and receive messages.
  411.  
  412.         The purpose of the Net BIOS is to isolate the application program 
  413.         from the actual type of hardware used in the LAN.  It also spares 
  414.         the application programmer the details of network error recovery 
  415.         and low level message addressing or routing.
  416.  
  417.  
  418.         Net Bios Names
  419.  
  420.         Each computer on the network is known and addressed by the other 
  421.         computers on the network by a name.  Each computer has a 
  422.         permanent name and can be given additional names by the user 
  423.         during network communication.  Names are 16 characters long and 
  424.         should not contain the asterisk (*) character.
  425.  
  426.         The permanent name is called the node number.  The node 
  427.         number is usually in ROM (read only memory) on the 
  428.         LAN adapter card or is set by dip switches on the LAN adapter 
  429.         card.  The node number consists of 10 characters of binary zeros 
  430.         followed by 6 more characters which must be unique on the 
  431.         network.
  432.  
  433.         Up to 16 local names may be added to the Net Bios for each 
  434.         computer on the network by the use of the ADD NAME and ADD GROUP 
  435.         NAME commands.  These names are stored in a local name 
  436.         table and are lost when the computer is turned off, or when the 
  437.         Net BIOS RESET command is issued.  A local name can be removed 
  438.         from the local name table by use of the Net BIOS DELETE NAME 
  439.         command. 
  440.  
  441.         The local names may be unique names or group names.  A unique name 
  442.         is guaranteed by the Net BIOS to be unique across the LAN.  A 
  443.         group name added at one computer may also be added, as a group 
  444.         name, at other computers.
  445.  
  446.         Data transfer commands must specify both a source and a 
  447.         destination name.  Since multiple names are allowed on 
  448.         each computer, several unrelated tasks may use the Net BIOS 
  449.         without interference.
  450.  
  451.  
  452.  
  453.  
  454.  
  455.  
  456.  
  457.                                        2
  458.  
  459.  
  460.  
  461.  
  462.  
  463.  
  464.  
  465.  
  466.         Types of data transfer
  467.  
  468.         Data can be transferred from computer to computer by using 
  469.         session level or datagram level commands of the Net BIOS.
  470.  
  471.         Session level commands allow user programs to communicate without 
  472.         requiring that they handle the details of network error detection 
  473.         or breaking larger messages into smaller messages to match any 
  474.         physical network limitations.  Session level commands are 
  475.         restricted to communication from one unique name to another.  Before 
  476.         using session level data transfer, the applications must 
  477.         negotiate a "logical connection".  This is accomplished by 
  478.         issuing a Net BIOS CALL command on one computer and a Net BIOS 
  479.         LISTEN command on another computer. 
  480.  
  481.         Datagram level data transfers are addressed to a lower level in 
  482.         the LAN adapter card.  The intialization requirements for sending 
  483.         or receiving a datagram message are simpler, however, more of the 
  484.         error control and data formatting problems are left to the user 
  485.         program.  Datagrams are also restricted in the size of messages 
  486.         to 512 bytes or less.  Datagrams are useful for performing 
  487.         functions not possible at the session level.  For example, a 
  488.         datagram message can be "broadcast" to more than one computer on 
  489.         the network at the same time.  
  490.  
  491.  
  492.         Data Transfer Example
  493.  
  494.         A session level data transfer sequence can be grouped into four 
  495.         steps.  Each step on one computer in the network must have a 
  496.         complementary step performed on another computer in the network.  
  497.  
  498.             (1)   Add a unique name to the Net BIOS local name table 
  499.                   using the ADD NAME command.
  500.                   
  501.             (2)   Initiate a session by using the CALL or LISTEN command.  
  502.                   If using a CALL, then another computer should have 
  503.                   performed a LISTEN. 
  504.             
  505.             (3)   Transfer messages using the SEND and RECEIVE commands.
  506.  
  507.             (4)   Terminate the session with the HANGUP command.
  508.  
  509.  
  510.         Calling Net BIOS
  511.  
  512.         Net BIOS commands are communicated to Net BIOS in the form of a 
  513.         Network Control Blocks (NCBs).  The user program is responsible 
  514.         for allocating space for and creating NCBs.  An NCB contains several 
  515.         fields.  Some fields are used to pass input values to Net BIOS 
  516.         while others are used by Net BIOS to return results from the 
  517.         command execution.  The NCB fields include a command code field 
  518.         and a command result field.  
  519.  
  520.  
  521.  
  522.  
  523.                                        3
  524.  
  525.  
  526.  
  527.  
  528.  
  529.  
  530.  
  531.  
  532.         After creating an NCB, it is passed to the Net BIOS by loading 
  533.         the address (segment:offset) of the NCB into the ES:BX registers, 
  534.         and then executing a software Interrupt 5C hex.  The Net BIOS 
  535.         will perform the operation specified by the command code field in 
  536.         the NCB.
  537.  
  538.  
  539.         Net Bios Command Modes
  540.  
  541.         Three command modes are available when executing a Net BIOS 
  542.         command:
  543.  
  544.              - Wait mode
  545.              - No-wait mode with completion post routine
  546.              - No-wait mode with polling
  547.  
  548.         In the wait mode, the Net BIOS will perform the command before 
  549.         returning to the calling program. The AL register will have the 
  550.         result of the operation.  The no-wait modes may queue the command 
  551.         for later execution and return program control to the user 
  552.         program immediately.  The user program can determine when the 
  553.         command has been completed by testing a flag in the NCB 
  554.         (polling) or by specifying the address of a "post" subroutine to 
  555.         be called when the command completes.
  556.  
  557.  
  558.  
  559.  
  560.  
  561.  
  562.  
  563.  
  564.  
  565.  
  566.  
  567.  
  568.  
  569.  
  570.  
  571.  
  572.  
  573.  
  574.  
  575.  
  576.  
  577.  
  578.  
  579.  
  580.  
  581.  
  582.  
  583.  
  584.  
  585.  
  586.  
  587.  
  588.  
  589.                                        4
  590.  
  591.  
  592.  
  593.  
  594.  
  595.  
  596.  
  597.  
  598.         Chapter 2  Communicating with Net Bios
  599.  
  600.         Commands are issued to the Net BIOS in the following manner:
  601.  
  602.              -    Allocate and initialize an NCB
  603.              -    Load the ES:BX registers with the address of the NCB
  604.              -    Execute an INT 5Ch instruction
  605.  
  606.         Two fields in the NCB determine the command mode, these are the 
  607.         high-order bit of the COMMAND field and the POST field.  The 
  608.         command field is an 8 bit code that specifies the desired action.  
  609.         The POST address is a double word pointer to a user routine to be 
  610.         called when the command is completed, or 0:0 to indicate no user 
  611.         routine.  The valid combinations are:
  612.  
  613.            High-Order Bit   Post Field     Mode
  614.  
  615.                 0           don't care     Wait
  616.  
  617.                 1           0:0            No-wait polling
  618.  
  619.                 1           address of     No-wait with post
  620.                             post routine
  621.  
  622.  
  623.         Wait Mode
  624.  
  625.         When a wait mode command is issued, the Net BIOS will not return 
  626.         control to the user program until the command has been completed.  
  627.         Upon return, the AL register will contain 0 if no error occurred 
  628.         or an error code value.  The AH register contents are destroyed, 
  629.         but other registers are not changed.  The error code in AL is the 
  630.         same as that contained in the NCB RETCODE field.
  631.  
  632.  
  633.         No-Wait Polling Mode
  634.  
  635.         The Net Bios will, after minimum processing, return immediately, 
  636.         even though the command may not have completed.  On return, the 
  637.         AL register will contain an immediate error code or 0.  
  638.  
  639.              Contents AL         Indicates
  640.  
  641.                 not 0            Command could not be queued 
  642.                                  (e.g., invalid COMMAND code).
  643.  
  644.                   0              Command was queued
  645.  
  646.         If the command was queued successfully then the program should 
  647.         poll the CMD_DONE field of the NCB, until CMD_DONE field is not 
  648.         0ffh.  This indicates that the command has completed and all 
  649.         other NCB fields are valid.  The AH register contents are 
  650.         destroyed, but other registers are not changed. 
  651.  
  652.  
  653.  
  654.  
  655.                                        5
  656.  
  657.  
  658.  
  659.  
  660.  
  661.  
  662.  
  663.  
  664.         No-Wait With Post Mode
  665.  
  666.         The Net Bios will return immediately, even though the command may 
  667.         not have completed.  On return, the AL register will contain an 
  668.         immediate error code or 0.
  669.  
  670.              Contents AL         Indicates
  671.  
  672.                 not 0            Command could not be queued 
  673.                                  (e.g., invalid COMMAND code).
  674.  
  675.                   0              Command was queued
  676.  
  677.  
  678.         If the command could not be queued, the POST routine will not be 
  679.         called. The AH register contents are destroyed, and other 
  680.         registers are not changed.
  681.  
  682.         If the command was queued, then when the command completes, the 
  683.         Net BIOS will call the user's POST routine with interrupts 
  684.         disabled, the stack set for an IRET, and ES:BX containing the 
  685.         address of the completed NCB. 
  686.  
  687.         Another Net BIOS command can be issued from the POST routine, 
  688.         however, it should also be a no-wait mode command.
  689.  
  690.         The user POST routine should be as short as possible and no 
  691.         registers should be changed.  Interrupts may be enabled in the 
  692.         POST routine.
  693.  
  694.         In some cases, the user's POST routine will be called before 
  695.         control is returned from the INT 5Ch that started the command.
  696.  
  697.  
  698.  
  699.  
  700.  
  701.  
  702.  
  703.  
  704.  
  705.  
  706.  
  707.  
  708.  
  709.  
  710.  
  711.  
  712.  
  713.  
  714.  
  715.  
  716.  
  717.  
  718.  
  719.  
  720.  
  721.                                        6
  722.  
  723.  
  724.  
  725.  
  726.  
  727.  
  728.  
  729.  
  730.         Chapter 3    Network Control Block Format
  731.  
  732.         Net BIOS commands must conform to a Network Control Block (NCB) 
  733.         format.  Network Control Blocks (NCBs) are 64 bytes in length and 
  734.         consist of 14 different fields.  All fields in a NCB should be 
  735.         initialized to zero.  The fields used in a command should then be 
  736.         set.  Results of the command are communicated through the NCB.  A 
  737.         description of each field in the NCB format follows.
  738.  
  739.         FIELD     DESCRIPTION
  740.  
  741.         COMMAND   A 1 byte field used for the Net Bios command code.  The 
  742.                   high order bit of this field should be set to 1 to 
  743.                   indicate no-wait mode or 0 to indicate wait mode.  The 
  744.                   remaining 7 bits are used for the command code.  All 
  745.                   Net BIOS commands except RESET and CANCEL have wait and 
  746.                   no-wait options.  In no-wait mode the POST field must 
  747.                   also be set.  In wait mode the Net BIOS waits for the 
  748.                   command to complete before returning to the calling 
  749.                   program.  In the no-wait mode the Net BIOS queues the 
  750.                   command for later execution and then returns to the 
  751.                   calling program, which may perform other processing or 
  752.                   issue additional Net BIOS commands. 
  753.  
  754.         RETCODE   A 1 byte field in which Net BIOS command results are 
  755.                   returned.  This field will contain a zero if no error 
  756.                   or an error code if an error was encountered.  The 
  757.                   error codes are listed in Appendix C.
  758.  
  759.         LSN       A 1 byte field containing the local session number that 
  760.                   is assigned by Net BIOS when a session is established.  
  761.                   This number will have a value between 1 and 254.  This 
  762.                   field is returned by CALL and LISTEN, and must be 
  763.                   supplied for SEND and RECEIVE commands.               
  764.  
  765.         NUM       A 1 byte field used for the name number associated with 
  766.                   the name in the local name table.  This number is 
  767.                   returned by ADD NAME commands and must be supplied for 
  768.                   RECEIVE ANY and datagram commands.  The value of this 
  769.                   number ranges from 1 to 254.              
  770.  
  771.         BUFADR    A 4 byte field used for the address of message to be 
  772.                   sent or received. 
  773.  
  774.         BUFLEN    A 2 byte field containing the length in bytes of 
  775.                   message buffer. For receive commands, this field is set 
  776.                   to the maximum buffer size and the actual length is 
  777.                   returned in this field upon completion of the Net BIOS 
  778.                   command.       
  779.  
  780.  
  781.  
  782.  
  783.  
  784.  
  785.  
  786.  
  787.                                        7
  788.  
  789.  
  790.  
  791.  
  792.  
  793.  
  794.  
  795.  
  796.         CALLNAME  A 16 byte field used to indicate the name of the 
  797.                   computer you want to communicate with for CALL, LISTEN 
  798.                   and datagrams.  For a CHAIN SEND  command, the first 
  799.                   word specifies the length of the second buffer, and the 
  800.                   next two words specify the address.  All 16 bytes must 
  801.                   be used.    
  802.  
  803.         NAME      A 16 byte field used to specify a local name.  
  804.                   Specifies a name to add to the local name table for ADD 
  805.                   NAME, or the name to use for other commands. 
  806.  
  807.         RTO       A 1 byte field used for receive time-out specifications 
  808.                   in .5 second increments.  Must be set for CALL and 
  809.                   LISTEN commands.  This field indicates the maximum time 
  810.                   that will be allowed before an error condition will 
  811.                   result on a receive command.  Once the session is 
  812.                   established this value remains constant throughout the 
  813.                   session.     
  814.  
  815.         STO       A 1 byte field used for send time-out specifications in 
  816.                   .5 second increments.  This field must be set for CALL 
  817.                   and LISTEN commands. If the time expires before the 
  818.                   send has completed a time out error will result and the 
  819.                   session will be terminated.
  820.  
  821.         POST      Address of user interrupt routine called when command 
  822.                   completes and no-wait mode  mode was specified in 
  823.                   command code. Not called if set to 0:0. 
  824.  
  825.         LANA_NUM  A 1 byte field that contains the number of the adapter 
  826.                   card to be addressed by the command.  It there are two 
  827.                   adapter cards installed on the same computer then a 0 
  828.                   in this field signifies that the command is addressing 
  829.                   the first card and a 1 indicates that the command is 
  830.                   addressing the second card.  If there is only one 
  831.                   adapter card in the computer then this field should 
  832.                   contain a 0. 
  833.  
  834.         CMD_DONE  A 1 byte field that is set by Net BIOS when a command 
  835.                   is completed. A value of 0FFH  indicates the command 
  836.                   has not completed.  When the command has completed, 
  837.                   CMD_DONE is set to same value as RETCODE.         
  838.  
  839.         RES       A 14 byte field used internally by Net Bios. Should not 
  840.                   be used for any other purposes.
  841.  
  842.  
  843.  
  844.  
  845.  
  846.  
  847.  
  848.  
  849.  
  850.  
  851.  
  852.  
  853.                                        8
  854.  
  855.  
  856.  
  857.  
  858.  
  859.  
  860.  
  861.  
  862.         Assembly Language NCB Structure
  863.  
  864.         Shown below is an example of an NCB defined in an assembly 
  865.         language program.
  866.  
  867.              NCB struc                 
  868.               ncb_command          db ?   ;command code
  869.               ncb_retcode          db ?   ;err ret code
  870.               ncb_lsn              db ?   ;session number
  871.               ncb_num              db ?   ;name number
  872.               ncb_bufadr           dd ?   ;ptr to send/recv data
  873.               ncb_buflen           dw ?   ;len of data
  874.               ncb_callname db 16 dup (?)  ;remote name
  875.               ncb_name     db 16 dup (?)  ;local name
  876.               ncb_rto              db ?   ;recv timeout
  877.               ncb_sto              db ?   ;send timeout
  878.               ncb_post             dd ?   ;async cmd complete post addr
  879.               ncb_lana_num         db ?   ;adapter number
  880.               ncb_cmd_done         db ?   ;0ffh until command completed
  881.               ncb_res      db 14 dup (?)  ;reserved
  882.              NCB ends
  883.  
  884.  
  885.  
  886.  
  887.  
  888.  
  889.  
  890.  
  891.  
  892.  
  893.  
  894.  
  895.  
  896.  
  897.  
  898.  
  899.  
  900.  
  901.  
  902.  
  903.  
  904.  
  905.  
  906.  
  907.  
  908.  
  909.  
  910.  
  911.  
  912.  
  913.  
  914.  
  915.  
  916.  
  917.  
  918.  
  919.                                        9
  920.  
  921.  
  922.  
  923.  
  924.  
  925.  
  926.  
  927.  
  928.         Chapter 4    Net BIOS Command Descriptions
  929.  
  930.         Net BIOS commands can be grouped into five classes.  These are
  931.  
  932.              -    General
  933.              -    Name
  934.              -    Session Control
  935.              -    Session Data Transfer
  936.              -    Datagram
  937.  
  938.         General commands include commands to reset Net BIOS and specify 
  939.         the number of sessions and NCBs to be supported, or to determine 
  940.         the status of the Net BIOS.
  941.  
  942.  
  943.         Session Control commands are used to initiate or terminate 
  944.         communication between two computers on the network, or to 
  945.         access the status information on a particular session.
  946.  
  947.         Session Data Transfer commands are used to send or receive 
  948.         messages between computers once the session has been established.
  949.  
  950.         Datagram commands are used to send and receive messages at a 
  951.         lower level in the LAN system.  These messages are restricted in 
  952.         size but can be sent to and received from more than one computer 
  953.         at a time.
  954.  
  955.         The commands available in each group are described below.  For 
  956.         each command, the required NCB fields are listed.  Although not 
  957.         absolutely required, it is good practice to initialize unused 
  958.         fields to zero in new NCBs.  It is generally not necessary to 
  959.         clear unused fields when re-using an NCB for another command.  
  960.         For example, a completed LISTEN command returns the name of the 
  961.         caller in the CALLNAME field.  It is not necessary to clear this 
  962.         field before using the same NCB for a RECEIVE command.
  963.  
  964.  
  965.  
  966.  
  967.  
  968.  
  969.  
  970.  
  971.  
  972.  
  973.  
  974.  
  975.  
  976.  
  977.  
  978.  
  979.  
  980.  
  981.  
  982.  
  983.  
  984.  
  985.                                        10
  986.  
  987.  
  988.  
  989.  
  990.  
  991.  
  992.  
  993.  
  994.         General Commands
  995.  
  996.         The general commands are
  997.  
  998.                   -    Reset
  999.                   -    Cancel
  1000.                   -    Adapter Status 
  1001.                   -    Unlink
  1002.  
  1003.         These commands can be used to reset Net BIOS and specify the 
  1004.         number of sessions and NCBs to be supported, to cancel previous 
  1005.         commands,  to determine the status of the Net BIOS, or to unlink 
  1006.         from diskless boot.  
  1007.  
  1008.  
  1009.                                   Reset Command
  1010.  
  1011.         Use this command to clear and configure the Net Bios.  
  1012.  
  1013.         Caution:  When this command is issued, all existing names and 
  1014.                   sessions are lost, therefore it should be issued before 
  1015.                   starting any processes that use the Net Bios.
  1016.  
  1017.         Caution:  In some implementations, session and command buffers 
  1018.                   take space otherwise used for packet buffers.  
  1019.                   Therefore, keep these parameters reasonable.
  1020.  
  1021.  
  1022.         NCB FIELDS SET:
  1023.  
  1024.              FIELD     DESCRIPTION          
  1025.  
  1026.              COMMAND   032h (Wait mode), No-wait mode not available
  1027.              LANA_NUM  Specifies which LANA the command is addressing 
  1028.              LSN       Number of sessions to be supported 
  1029.                        Possible values between 1 and 32 
  1030.              NUM       Number of commands (NCBs) outstanding at one time 
  1031.                        Possible values between 1 and 32
  1032.  
  1033.  
  1034.         NCB FIELDS RETURNED:
  1035.  
  1036.              FIELD     DESCRIPTION          
  1037.  
  1038.              RETCODE   Error code or 0 if no error.
  1039.              CMD_DONE  FF until command done
  1040.  
  1041.  
  1042.  
  1043.  
  1044.  
  1045.  
  1046.  
  1047.  
  1048.  
  1049.  
  1050.  
  1051.                                        11
  1052.  
  1053.  
  1054.  
  1055.  
  1056.  
  1057.  
  1058.  
  1059.  
  1060.  
  1061.                                  Cancel Command
  1062.  
  1063.         Use this command to cancel a previous command.  
  1064.  
  1065.         Caution:  If this command is used with a SEND or CHAIN SEND 
  1066.                   command the session will be terminated.
  1067.  
  1068.                   The following commands cannot be canceled:  
  1069.  
  1070.                        RESET                 DELETE NAME      
  1071.                        CANCEL                SESSION STATUS   
  1072.                        ADD NAME              SEND DATAGRAM    
  1073.                        ADD GROUP NAME        SEND BROADCAST        
  1074.  
  1075.  
  1076.         NCB FIELDS SET:
  1077.  
  1078.              FIELD     DESCRIPTION          
  1079.  
  1080.              COMMAND   035h (Wait mode), No-wait mode not available
  1081.              LANA_NUM  Specifies which LANA the command is addressing 
  1082.              BUFADR    Address of the NCB for the previous command.   
  1083.  
  1084.  
  1085.         NCB FIELDS RETURNED:
  1086.  
  1087.              FIELD     DESCRIPTION          
  1088.  
  1089.              RETCODE   Error code or 0 if no error.
  1090.              CMD_DONE  FF until command done
  1091.  
  1092.  
  1093.  
  1094.  
  1095.  
  1096.  
  1097.  
  1098.  
  1099.  
  1100.  
  1101.  
  1102.  
  1103.  
  1104.  
  1105.  
  1106.  
  1107.  
  1108.  
  1109.  
  1110.  
  1111.  
  1112.  
  1113.  
  1114.  
  1115.  
  1116.  
  1117.                                        12
  1118.  
  1119.  
  1120.  
  1121.  
  1122.  
  1123.  
  1124.  
  1125.  
  1126.                              Adapter Status Command
  1127.  
  1128.         Use this command to get the status of a Net Bios -- either 
  1129.         local or remote.  
  1130.  
  1131.         The format of the Adapter Status Result buffer is shown in Table 1.
  1132.         The actual size of the status buffer will be 60 + 18n, where n is 
  1133.         the number of names in the name table of the selected Net Bios 
  1134.         (the permanent node name is not counted).
  1135.  
  1136.  
  1137.         NCB FIELDS SET:   
  1138.  
  1139.              FIELD     DESCRIPTION          
  1140.  
  1141.              COMMAND   033h (Wait mode), 0B3h (No-wait mode)
  1142.              LANA_NUM  Specifies which LANA the command is addressing      
  1143.              CALLNAME  Use asterisk as first character to refer to local Net BIOS
  1144.                        Use 15 character name to refer to remote Net BIOS
  1145.              BUFADR    Starting address of status report buffer 
  1146.              BUFLEN    Size of status report buffer, 348 bytes maximum
  1147.              POST      Used in no-wait mode only, 
  1148.                        Contains address of post routine or 0:0 
  1149.  
  1150.  
  1151.  
  1152.         NCB FIELDS RETURNED:
  1153.  
  1154.              FIELD     DESCRIPTION          
  1155.  
  1156.              BUFLEN    Actual size of status report buffer
  1157.              RETCODE   Error code or 0 if no error.
  1158.              CMD_DONE  FF until command done
  1159.  
  1160.  
  1161.  
  1162.  
  1163.  
  1164.  
  1165.  
  1166.  
  1167.  
  1168.  
  1169.  
  1170.  
  1171.  
  1172.  
  1173.  
  1174.  
  1175.  
  1176.  
  1177.  
  1178.  
  1179.  
  1180.  
  1181.  
  1182.  
  1183.                                        13
  1184.  
  1185.  
  1186.  
  1187.  
  1188.  
  1189.  
  1190.  
  1191.  
  1192.                                      Table 1
  1193.                           Adapter Status Result Buffer
  1194.                      
  1195.  
  1196.         ^U  Offset    Bytes   Field Description
  1197.         ___(Hex)    (Dec)________________________________________________
  1198.  
  1199.              0       6      Permanent node name.  This six byte identifier   
  1200.                             is obtained from either a ROM on the LAN card    
  1201.                             or from the node address DIP switch.             
  1202.  
  1203.              6       1      External jumper status.  The high bit of this    
  1204.                             byte indicates the interrupt number used by      
  1205.                             the LAN card -- 0 for IRQ 2 and 1 for IRQ 3.     
  1206.                             The second highest bit indicates the DMA chan-   
  1207.                             nel used by the LAN card -- 0 for channel 1      
  1208.                             and 1 for channel 3.  This byte is not sup-      
  1209.                             ported in all implementations.                   
  1210.  
  1211.              7       1      Power on test result.  Always zero in current    
  1212.                             versions.                                        
  1213.  
  1214.              8       2      Software version.  First byte is the major       
  1215.                             version, second is the minor version number.     
  1216.  
  1217.             0A       2      Minutes since system started.  When this field   
  1218.                             reaches 0FFFFH, it rolls over to 0.              
  1219.  
  1220.             0C       2      Number of CRC errors on received packets. (1)    
  1221.  
  1222.             0E       2      Number of alignment errors. (1)                  
  1223.  
  1224.             10       2      Number of transmit collisions.  (1)              
  1225.  
  1226.             12       2      Number of aborted transmits.  (1)                
  1227.  
  1228.             14       4      Number of packets transmitted.  When this        
  1229.                             field reaches 0FFFFFFFFH, it rolls over to 0.    
  1230.  
  1231.             18       4      Number of packets received.  When this field     
  1232.                             reaches 0FFFFFFFFH, it rolls over to 0.          
  1233.  
  1234.             1C       2      Number of retransmits. (1)                       
  1235.  
  1236.             1E       2      Number of times receiver was out of buffers.     
  1237.                             (1)                                              
  1238.  
  1239.             20       8      Not used -- reserved.                            
  1240.  
  1241.                               (Continued Next Page)
  1242.  
  1243.  
  1244.  
  1245.  
  1246.  
  1247.  
  1248.  
  1249.                                        14
  1250.  
  1251.  
  1252.  
  1253.  
  1254.  
  1255.  
  1256.  
  1257.  
  1258.                                Table 1 (Continued)
  1259.                           Adapter Status Result Buffer
  1260.  
  1261.  
  1262.           Offset    Bytes   Field Description
  1263.         ___(Hex)    (Dec)________________________________________________
  1264.            
  1265.             28       2      Number of free network command blocks (NCBs).    
  1266.                             (2)                                              
  1267.  
  1268.             2A       2      Number of NCBs specified in last RESET command.  
  1269.  
  1270.             2C       2      Maximum possible number of NCBs that can be      
  1271.                             specified in RESET command.                      
  1272.  
  1273.             2E       4      Not used -- reserved.                            
  1274.  
  1275.             32       2      Number of pending or active sessions.            
  1276.  
  1277.             34       2      Number of possible sessions specified in last    
  1278.                             RESET command.                                   
  1279.  
  1280.             36       2      Maximum number of possible sessions that can     
  1281.                             be specified in RESET command.                   
  1282.  
  1283.             38       2      Maximum packet size supported on the network.    
  1284.                             Note, this is not related to the maximum         
  1285.                             session message size, which is 64K bytes.        
  1286.  
  1287.             3A       2      Number of names in name table.                   
  1288.  
  1289.             3C      18      First name in name table. (3)                    
  1290.                               * 16 bytes - name                              
  1291.                               *  1 byte  - name number (2 to 254)            
  1292.                               *  1 byte  - name status.  Bit patterns are:   
  1293.                                    *  G----000 - name add in progress        
  1294.                                    *  G----100 - active name                 
  1295.                                    *  G----101 - delete pending              
  1296.                                    *  G----110 - improper duplicate name     
  1297.                                    *  G----111 - duplicate name, delete      
  1298.                                                  pending                     
  1299.  
  1300.             4E     X18      Addition name table entries as needed.           
  1301.  
  1302.  
  1303.  
  1304.         Notes
  1305.           1  These fields will not increment further after reaching 
  1306.              0FFFFH.
  1307.           2  In some implementations, there is no limit on the number of 
  1308.              NCBs pending, so an arbitrary large number is used in these 
  1309.              fields.
  1310.           3  The permanent name (name number 1) does not appear in the 
  1311.              name table.
  1312.  
  1313.  
  1314.  
  1315.                                        15
  1316.  
  1317.  
  1318.  
  1319.  
  1320.  
  1321.  
  1322.  
  1323.  
  1324.                                  Unlink Command
  1325.  
  1326.         Use this command to cancel diskless boot redirection.  Typically, 
  1327.         a diskless boot ROM makes a connection with a process that 
  1328.         supplies a virtual floppy image and redirects INT 13 requests for 
  1329.         drive A to this network device.  This command cancels that 
  1330.         redirection so that the local drive A may be accessed.  
  1331.  
  1332.         Caution:  Once this command is issued, there is no way to
  1333.                   re-establish the diskless boot connection.
  1334.  
  1335.  
  1336.         NCB FIELDS SET:   
  1337.  
  1338.              FIELD     DESCRIPTION          
  1339.  
  1340.              COMMAND   070h (Wait mode), No-wait mode not available
  1341.              LANA_NUM  Specifies which LANA the command is addressing      
  1342.  
  1343.  
  1344.         NCB FIELDS RETURNED:
  1345.  
  1346.              FIELD     DESCRIPTION          
  1347.  
  1348.              RETCODE   Error code or 0 if no error.
  1349.              CMD_DONE  FF until command done
  1350.  
  1351.  
  1352.  
  1353.  
  1354.  
  1355.  
  1356.  
  1357.  
  1358.  
  1359.  
  1360.  
  1361.  
  1362.  
  1363.  
  1364.  
  1365.  
  1366.  
  1367.  
  1368.  
  1369.  
  1370.  
  1371.  
  1372.  
  1373.  
  1374.  
  1375.  
  1376.  
  1377.  
  1378.  
  1379.  
  1380.  
  1381.                                        16
  1382.  
  1383.  
  1384.  
  1385.  
  1386.  
  1387.  
  1388.  
  1389.  
  1390.  
  1391.                                   NAME COMMANDS
  1392.  
  1393.  
  1394.         Name commands allow the addition and deletion of local and group 
  1395.         names for a computer on the network. The name commands are:
  1396.  
  1397.                   -    Add name
  1398.                   -    Add group name
  1399.                   -    Delete name
  1400.  
  1401.         Following is a description of the name commands and the NCB 
  1402.         fields that are used for these commands.  
  1403.  
  1404.  
  1405.  
  1406.                                 Add Name Command
  1407.  
  1408.         Use this command to add a name to the Net Bios local name table.  
  1409.         The name must be unique across the network.  
  1410.  
  1411.         NCB FIELDS SET:
  1412.  
  1413.              FIELD     DESCRIPTION          
  1414.  
  1415.              COMMAND   030h (Wait mode), 0B0h (No-wait mode)
  1416.              LANA_NUM  Specifies which LANA the command is addressing      
  1417.              NAME      16 Character name . . .
  1418.              POST      Used in no-wait mode only, 
  1419.                        Contains address of post routine or 0:0 
  1420.  
  1421.  
  1422.         NCB FIELDS RETURNED:  
  1423.  
  1424.              FIELD     DESCRIPTION          
  1425.  
  1426.              NUM       Name number, if successful, between 1 and 254
  1427.              RETCODE   Error code or 0 if no error.
  1428.              CMD_DONE  FF until command done
  1429.  
  1430.  
  1431.  
  1432.  
  1433.  
  1434.  
  1435.  
  1436.  
  1437.  
  1438.  
  1439.  
  1440.  
  1441.  
  1442.  
  1443.  
  1444.  
  1445.  
  1446.  
  1447.                                        17
  1448.  
  1449.  
  1450.  
  1451.  
  1452.  
  1453.  
  1454.  
  1455.  
  1456.  
  1457.                              Add Group Name Command
  1458.  
  1459.         Use this command to add a non-unique name to the Net Bios local name 
  1460.         table.  It the name already exists as a unique name by any other 
  1461.         process or machine an error code will be returned in the RETCODE 
  1462.         field and the name will not be added to the local name table.  
  1463.  
  1464.         Group names provide a mechanism to "broadcast" messages to a 
  1465.         specific group of computers on the system.  SEND DATAGRAM to a 
  1466.         group name will be received by all computers that have issued a 
  1467.         RECEIVE DATAGRAM under the group name.
  1468.  
  1469.  
  1470.         NCB FIELDS SET:
  1471.  
  1472.              FIELD     DESCRIPTION          
  1473.  
  1474.              COMMAND   036h (Wait mode), 0B6h (No-wait mode)    
  1475.              LANA_NUM  Specifies which LANA the command is addressing      
  1476.              NAME      16 Character name . . .
  1477.              POST      Used in no-wait mode only, 
  1478.                        Contains address of post routine or 0:0 
  1479.  
  1480.  
  1481.         NCB FIELDS RETURNED:
  1482.  
  1483.              FIELD     DESCRIPTION          
  1484.  
  1485.              NUM       Name number, if successful, between 1 and 254    
  1486.              RETCODE   Error code or 0 if no error.
  1487.              CMD_DONE  FF until command done
  1488.  
  1489.  
  1490.  
  1491.  
  1492.  
  1493.  
  1494.  
  1495.  
  1496.  
  1497.  
  1498.  
  1499.  
  1500.  
  1501.  
  1502.  
  1503.  
  1504.  
  1505.  
  1506.  
  1507.  
  1508.  
  1509.  
  1510.  
  1511.  
  1512.  
  1513.                                        18
  1514.  
  1515.  
  1516.  
  1517.  
  1518.  
  1519.  
  1520.  
  1521.  
  1522.  
  1523.                                Delete Name Command
  1524.  
  1525.         Use this command to delete a name from the Net Bios local name table.  
  1526.         If no sessions are active under the name to be deleted, the name 
  1527.         will be deleted.  If any sessions are active, then the command 
  1528.         will not complete until these sessions are terminated.
  1529.  
  1530.         Caution:  Any of the following commands outstanding and 
  1531.                   associated with the deleted command will be terminated 
  1532.                   with RETCODE = 17h (name was deleted): 
  1533.                   
  1534.                        LISTEN              RECEIVE ANY
  1535.                        RECEIVE DATAGRAM    RECEIVE 
  1536.                        BROADCAST
  1537.  
  1538.  
  1539.         NCB FIELDS SET:
  1540.  
  1541.              FIELD     DESCRIPTION          
  1542.  
  1543.              COMMAND   031h (Wait mode), 0B1h (No-wait mode)
  1544.              LANA_NUM  Specifies which LANA the command is addressing      
  1545.              NAME      16 Character name . . .
  1546.              POST      Used in no-wait mode only, 
  1547.                        Contains address of post routine or 0:0 
  1548.  
  1549.  
  1550.         NCB FIELDS RETURNED:
  1551.  
  1552.              FIELD     DESCRIPTION          
  1553.  
  1554.              RETCODE   17h            If name was deleted
  1555.              CMD_DONE  FF             Until command done
  1556.  
  1557.  
  1558.  
  1559.  
  1560.  
  1561.  
  1562.  
  1563.  
  1564.  
  1565.  
  1566.  
  1567.  
  1568.  
  1569.  
  1570.  
  1571.  
  1572.  
  1573.  
  1574.  
  1575.  
  1576.  
  1577.  
  1578.  
  1579.                                        19
  1580.  
  1581.  
  1582.  
  1583.  
  1584.  
  1585.  
  1586.  
  1587.  
  1588.  
  1589.                             SESSION CONTROL COMMANDS
  1590.  
  1591.         Session control commands are used to initiate or terminate 
  1592.         communication between two computers on the network, or to 
  1593.         access the status information on a particular session.
  1594.  
  1595.         Session control commands are:
  1596.  
  1597.                   -    Call
  1598.                   -    Listen
  1599.                   -    Hang up
  1600.                   -    Session Status
  1601.  
  1602.         The commands available in this group are described below.  For 
  1603.         each command, the required NCB fields are listed. 
  1604.  
  1605.  
  1606.  
  1607.                                   Call Command
  1608.  
  1609.         This command is used to establish a session with another machine 
  1610.         or process.  
  1611.  
  1612.         A LISTEN command must be outstanding for the called (remote) 
  1613.         name.  The session number is used when sending or receiving 
  1614.         session data, or in the HANG UP (session terminate) command.
  1615.  
  1616.  
  1617.         NCB FIELDS SET:
  1618.  
  1619.              FIELD     DESCRIPTION          
  1620.  
  1621.              COMMAND   010h (Wait mode), 090h (No-wait mode)
  1622.              LANA_NUM  Specifies which LANA the command is addressing      
  1623.              CALLNAME  Remote name
  1624.              NAME      Local name
  1625.              RTO       Receive timeout     
  1626.              STO       Send timeout
  1627.              POST      Used in no-wait mode only, 
  1628.                        Contains address of post routine or 0:0 
  1629.  
  1630.  
  1631.         NCB FIELDS RETURNED: 
  1632.  
  1633.              FIELD     DESCRIPTION          
  1634.  
  1635.              LSN       Session number, when successful, between 1 and 254
  1636.              RETCODE   Error code or 0 if no error.
  1637.              CMD_DONE  FF until command done
  1638.  
  1639.  
  1640.  
  1641.  
  1642.  
  1643.  
  1644.  
  1645.                                        20
  1646.  
  1647.  
  1648.  
  1649.  
  1650.  
  1651.  
  1652.  
  1653.  
  1654.  
  1655.                                  Listen Command
  1656.  
  1657.         Use this command to wait for a session to be established.  
  1658.         The session will be established when another machine or process 
  1659.         executes a CALL to the name associated with the LISTEN command.  
  1660.  
  1661.         More than one session can be established under the same name, or 
  1662.         same pair of names.
  1663.  
  1664.         PRIORITY:  Regardless of order in which the LISTENs are issued,   
  1665.         a CALL received from a specific name when there is a LISTEN 
  1666.         pending with a matching CALLNAME will take precedence over a
  1667.         LISTEN for any name (* in first character) command.
  1668.  
  1669.  
  1670.         NCB FIELDS SET:   
  1671.  
  1672.              FIELD     DESCRIPTION          
  1673.  
  1674.              COMMAND   011h (Wait mode), 091h (No-wait mode)
  1675.              LANA_NUM  Specifies which LANA the command is addressing      
  1676.              NAME      Local name under which session will be established.  
  1677.              CALLNAME  Name of the caller, 
  1678.                        If '*' is the first character, accept call from any name.  
  1679.              RTO       Receive timeout
  1680.              STO       Send timeout
  1681.              POST      Used in no-wait mode only, 
  1682.                        Contains address of post routine or 0:0 
  1683.  
  1684.  
  1685.         NCB FIELDS RETURNED:
  1686.  
  1687.              FIELD     DESCRIPTION          
  1688.  
  1689.              LSN       Session number, between 1 and 254
  1690.                        This number is used when sending or receiving 
  1691.                        session data, or in the HANG UP (session terminate) command.  
  1692.              CALLNAME  Contains caller's name if '*' was used as input 
  1693.              RETCODE   Error code or 0 if no error.
  1694.              CMD_DONE  FF until command done
  1695.  
  1696.  
  1697.  
  1698.  
  1699.  
  1700.  
  1701.  
  1702.  
  1703.  
  1704.  
  1705.  
  1706.  
  1707.  
  1708.  
  1709.  
  1710.  
  1711.                                        21
  1712.  
  1713.  
  1714.  
  1715.  
  1716.  
  1717.  
  1718.  
  1719.  
  1720.  
  1721.                                  Hang Up Command
  1722.  
  1723.         Use this command to close or terminate a session.  It may be 
  1724.         issued by either the CALLer or LISTENer.  
  1725.  
  1726.         If any RECEIVE commands for the session are outstanding on the 
  1727.         machine issuing the HANG UP, they are completed with RETCODE = 
  1728.         0Ah (session closed).  
  1729.  
  1730.         If SEND commands are outstanding, the HANG UP completion will be 
  1731.         delayed until the SEND has completed.
  1732.  
  1733.         If the remote end has any RECEIVE or SEND commands in progress 
  1734.         when HANG UP is started, they will be terminated with 
  1735.         RETCODE = 0Ah.  
  1736.  
  1737.         If no remote RECEIVEs or SENDs are terminated with session 
  1738.         closed, and if RECEIVE ANY commands are outstanding at the 
  1739.         remote, one and only one of the RECEIVE ANYs will be terminated 
  1740.         with the session closed error.  
  1741.  
  1742.         If no commands are outstanding at the remote machine when the 
  1743.         HANG UP occurs, then the next session command issued by the 
  1744.         remote will be terminated RETCODE set to either 08h (invalid 
  1745.         session) or 0Ah (session closed).
  1746.  
  1747.  
  1748.         NCB FIELDS USED:   
  1749.  
  1750.              FIELD     DESCRIPTION          
  1751.  
  1752.              COMMAND   012h (Wait mode), 092h (No-wait mode)
  1753.              LANA_NUM  Specifies which LANA the command is addressing      
  1754.              LSN       Session number of the session to be closed.
  1755.              POST
  1756.  
  1757.  
  1758.         NCB FIELDS RETURNED:
  1759.  
  1760.              FIELD     DESCRIPTION          
  1761.  
  1762.              RETCODE   Error code or 0 if no error.
  1763.              CMD_DONE  FF until command done
  1764.  
  1765.  
  1766.  
  1767.  
  1768.  
  1769.  
  1770.  
  1771.  
  1772.  
  1773.  
  1774.  
  1775.  
  1776.  
  1777.                                        22
  1778.  
  1779.  
  1780.  
  1781.  
  1782.  
  1783.  
  1784.  
  1785.  
  1786.  
  1787.                              Session Status Command
  1788.  
  1789.         Use this command to obtain the status of all sessions associated 
  1790.         with a given name.  Table 2 on the following page shows the 
  1791.         format of the status.  
  1792.  
  1793.  
  1794.         NCB FIELDS SET:   
  1795.  
  1796.              FIELD     DESCRIPTION          
  1797.  
  1798.              COMMAND   034h (Wait mode), 0B4h (No-wait mode)
  1799.              LANA_NUM  Specifies which LANA the command is addressing      
  1800.              NAME      Name for which status desired
  1801.              BUFADR    Address of buffer to receive status report
  1802.              BUFLEN    Length of buffer (at least 4)  
  1803.              POST      Used in no-wait mode only, 
  1804.                        Contains address of post routine or 0:0 
  1805.  
  1806.  
  1807.         NCB FIELDS RETURNED:
  1808.  
  1809.              FIELD     DESCRIPTION          
  1810.  
  1811.              RETCODE   06h, If message incomplete, buffer not large enough
  1812.                        00,  If no error
  1813.              BUFLEN    Actual size of buffer
  1814.              CMD_DONE  FF until command done
  1815.  
  1816.  
  1817.  
  1818.  
  1819.  
  1820.  
  1821.  
  1822.  
  1823.  
  1824.  
  1825.  
  1826.  
  1827.  
  1828.  
  1829.  
  1830.  
  1831.  
  1832.  
  1833.  
  1834.  
  1835.  
  1836.  
  1837.  
  1838.  
  1839.  
  1840.  
  1841.  
  1842.  
  1843.                                        23
  1844.  
  1845.  
  1846.  
  1847.  
  1848.  
  1849.  
  1850.  
  1851.  
  1852.                                      Table 2
  1853.                           Session Status Result Buffer
  1854.  
  1855.                                       
  1856.         Offset   Byte Size  Field Description                    
  1857.          (Hex)     (Dec) 
  1858.  
  1859.            0         1      Sessions' name number.                           
  1860.  
  1861.            1         1      Number of sessions under name.                   
  1862.  
  1863.            2         1      Number of RECEIVE DATAGRAM and RECEIVE           
  1864.                             BROADCAST commands outstanding.                  
  1865.          
  1866.            3         1      Number of RECEIVE ANY commands outstanding.      
  1867.  
  1868.           (4)      (36)     Session status - first session (if at least 1).  
  1869.            4         1       * Local session number (LSN).                   
  1870.            5         1       * Session state                                 
  1871.                                 1: LISTEN pending   4: HANG UP pending       
  1872.                                 2: CALL pending     5: HANG UP complete      
  1873.                                 3: Active           6: Session aborted       
  1874.            6        16       * Local name (NAME)                             
  1875.           16        16       * Remote name (CALLNAME)                        
  1876.           26         1       * Number of RECEIVE commands outstanding        
  1877.           27         1       * Number of SEND and CHAIN SEND commands        
  1878.                               outstanding                                   
  1879.           28       X36     Session status for additional sessions as        
  1880.                             needed                                           
  1881.  
  1882.  
  1883.  
  1884.  
  1885.  
  1886.  
  1887.  
  1888.  
  1889.  
  1890.  
  1891.  
  1892.  
  1893.  
  1894.  
  1895.  
  1896.  
  1897.  
  1898.  
  1899.  
  1900.  
  1901.  
  1902.  
  1903.  
  1904.  
  1905.  
  1906.  
  1907.  
  1908.  
  1909.                                        24
  1910.  
  1911.  
  1912.  
  1913.  
  1914.  
  1915.  
  1916.  
  1917.  
  1918.                           SESSION DATA TRANSFER COMMANDS
  1919.  
  1920.         Session Data Transfer commands are used to send or receive 
  1921.         messages between computers once the session has been established.
  1922.  
  1923.         Session data transfer commands are:
  1924.  
  1925.                   -    Send
  1926.                   -    Chain Send
  1927.                   -    Receive
  1928.                   -    Receive Any
  1929.  
  1930.         Once a session is established, the Net Bios maintains tables that 
  1931.         allow the process to specify the remote computer for data transfer 
  1932.         with a session number.  Send and receive commands use this 
  1933.         session number for data transmission.  In addition, a "receive 
  1934.         any" command allows a process to receive messages from any of the 
  1935.         sessions it has established.
  1936.  
  1937.         The commands available in this group are described below.  For 
  1938.         each command, the required NCB fields are listed. 
  1939.  
  1940.  
  1941.  
  1942.  
  1943.  
  1944.  
  1945.  
  1946.  
  1947.  
  1948.  
  1949.  
  1950.  
  1951.  
  1952.  
  1953.  
  1954.  
  1955.  
  1956.  
  1957.  
  1958.  
  1959.  
  1960.  
  1961.  
  1962.  
  1963.  
  1964.  
  1965.  
  1966.  
  1967.  
  1968.  
  1969.  
  1970.  
  1971.  
  1972.  
  1973.  
  1974.  
  1975.                                        25
  1976.  
  1977.  
  1978.  
  1979.  
  1980.  
  1981.  
  1982.  
  1983.  
  1984.  
  1985.                                   Send Command
  1986.  
  1987.         Use this command to send data to the machine or process with which a 
  1988.         session as been established.  The remote session must have issued 
  1989.         (or issue before the time-out specified earlier in STO) a RECEIVE 
  1990.         or RECEIVE ANY command.
  1991.  
  1992.         Priority: SENDs are performed in the order in which they are 
  1993.                   issued.  
  1994.  
  1995.         Caution:  If an error occurs on the send, then the session is 
  1996.                   terminated.
  1997.  
  1998.  
  1999.         NCB FIELDS USED:
  2000.  
  2001.              FIELD     DESCRIPTION          
  2002.  
  2003.              COMMAND   014h (Wait mode), 094h (No-wait mode)
  2004.              LANA_NUM  Specifies which LANA the command is addressing      
  2005.              LSN       Session number
  2006.              BUFADR    Start address of buffer 
  2007.              BUFLEN    Length of buffer
  2008.              POST      Used in no-wait mode only, 
  2009.                        Contains address of post routine or 0:0 
  2010.  
  2011.  
  2012.         NCB FIELDS RETURNED:
  2013.  
  2014.              FIELD     DESCRIPTION          
  2015.  
  2016.              RETCODE   Error code or 0 if no error.
  2017.              CMD_DONE  FF until command done
  2018.  
  2019.  
  2020.  
  2021.  
  2022.  
  2023.  
  2024.  
  2025.  
  2026.  
  2027.  
  2028.  
  2029.  
  2030.  
  2031.  
  2032.  
  2033.  
  2034.  
  2035.  
  2036.  
  2037.  
  2038.  
  2039.  
  2040.  
  2041.                                        26
  2042.  
  2043.  
  2044.  
  2045.  
  2046.  
  2047.  
  2048.  
  2049.  
  2050.  
  2051.                                Chain Send Command
  2052.  
  2053.         The CHAIN SEND command is similar to the SEND command, except the 
  2054.         data to be transferred is contained in two separate buffers.  
  2055.         CHAIN send concatenates these buffers -- the receiving end will 
  2056.         see one message.  
  2057.  
  2058.  
  2059.         NCB FIELDS SET:
  2060.  
  2061.              FIELD          DESCRIPTION          
  2062.  
  2063.              COMMAND        017h (Wait mode), 097h (No-wait mode)
  2064.              LANA_NUM       Specifies which LANA the command is addressing      
  2065.              BUFADR         Address of first buffer
  2066.              BUFLEN         Length of first buffer
  2067.              CALLNAME+2     Address of second buffer
  2068.              CALLNAME+0     Length of second buffer
  2069.              LSN            Local session number
  2070.              POST           Used in no-wait mode only, 
  2071.                             Contains address of post routine or 0:0 
  2072.  
  2073.         The total length of both buffers cannot exceed 65535 bytes.
  2074.  
  2075.  
  2076.         NCB FIELDS RETURNED:
  2077.  
  2078.              FIELD     DESCRIPTION          
  2079.  
  2080.              RETCODE   Error code or 0 if no error.
  2081.              CMD_DONE  FF until command done
  2082.  
  2083.  
  2084.  
  2085.  
  2086.  
  2087.  
  2088.  
  2089.  
  2090.  
  2091.  
  2092.  
  2093.  
  2094.  
  2095.  
  2096.  
  2097.  
  2098.  
  2099.  
  2100.  
  2101.  
  2102.  
  2103.  
  2104.  
  2105.  
  2106.  
  2107.                                        27
  2108.  
  2109.  
  2110.  
  2111.  
  2112.  
  2113.  
  2114.  
  2115.  
  2116.  
  2117.                                  Receive Command
  2118.  
  2119.         Use this command to receive data from a computer or process with 
  2120.         which a session as been established.  The remote session must 
  2121.         issue a SEND or CHAIN SEND command.  
  2122.  
  2123.         If a send is not issued by the remote within the time specified 
  2124.         earlier in RTO, the RECEIVE will complete with a time out error 
  2125.         (RETCODE = 05h).   Time outs do not cause session termination. 
  2126.  
  2127.         PRIORITY:  RECEIVE commands are completed in the order in which 
  2128.         they are issued.  If received data could be used to complete 
  2129.         either a RECEIVE or RECEIVE ANY, the RECEIVE is given priority 
  2130.         and completed.
  2131.  
  2132.         If the maximum buffer length was smaller than the length of the 
  2133.         data, then the buffer is filled to the maximum and RETCODE = 06h 
  2134.         is returned.  The next RECEIVE (or RECEIVE ANY) will be completed 
  2135.         with the remainder of the data.
  2136.  
  2137.  
  2138.         NCB FIELDS USED:
  2139.  
  2140.              FIELD     DESCRIPTION          
  2141.  
  2142.              COMMAND   015h (Wait mode), 095h (No-wait mode)
  2143.              LANA_NUM  Specifies which LANA the command is addressing      
  2144.              LSN       Session number
  2145.              BUFADR    Address of buffer  
  2146.              BUFLEN    Maximum length of receive data buffer.
  2147.              POST      Used in no-wait mode only, 
  2148.                        Contains address of post routine or 0:0 
  2149.  
  2150.  
  2151.         NCB FIELDS RETURNED:
  2152.  
  2153.              FIELD     DESCRIPTION          
  2154.  
  2155.              BUFLEN    Actual size of the received data 
  2156.              RETCODE   Error code or 0 if no error.
  2157.              CMD_DONE  FF until command done
  2158.  
  2159.  
  2160.  
  2161.  
  2162.  
  2163.  
  2164.  
  2165.  
  2166.  
  2167.  
  2168.  
  2169.  
  2170.  
  2171.  
  2172.  
  2173.                                        28
  2174.  
  2175.  
  2176.  
  2177.  
  2178.  
  2179.  
  2180.  
  2181.  
  2182.  
  2183.                                Receive Any Command
  2184.  
  2185.         Use this command to receive data from any session.  The remote 
  2186.         session must issue a SEND or CHAIN SEND command.  There is no 
  2187.         time-out on this command.  
  2188.  
  2189.         PRIORITY:  RECEIVE ANY commands are completed in the order in 
  2190.         which they are issued.  If received data could be used to 
  2191.         complete either a RECEIVE or RECEIVE ANY, the RECEIVE is given 
  2192.         priority and completed.
  2193.  
  2194.         If the maximum buffer length was smaller than the length of the 
  2195.         data, then the buffer is filled to the maximum and RETCODE = 06h 
  2196.         is returned.  The next RECEIVE ANY (or RECEIVE) will be completed 
  2197.         with the remainder of the data.
  2198.  
  2199.         RECEIVE ANY is used by a process that services multiple users.  
  2200.         Session termination by the local or remote process will cause the 
  2201.         next pending RECEIVE ANY to complete with RETCODE = 0Ah (session 
  2202.         terminated) or 18h (session terminated abnormally).
  2203.  
  2204.  
  2205.         NCB FIELDS SET:   
  2206.  
  2207.              FIELD     DESCRIPTION          
  2208.  
  2209.              COMMAND   016h (Wait mode), 096h (No-wait mode)
  2210.              LANA_NUM  Specifies which LANA the command is addressing      
  2211.              NUM       Name number of allowable sessions, 
  2212.                        or 0FFh to receive for any session under any name.  
  2213.              BUFADR    Address of the receive data buffer
  2214.              BUFLEN    Maximum length of the receive data buffer
  2215.              POST      Used in no-wait mode only, 
  2216.                        Contains address of post routine or 0:0 
  2217.  
  2218.  
  2219.         NCB FIELDS RETURNED:
  2220.  
  2221.              FIELD     DESCRIPTION          
  2222.  
  2223.              LSN       Local session number of a completed receive 
  2224.              BUFLEN    Actual size of the received data 
  2225.              RETCODE   Error code or 0 if no error.
  2226.              CMD_DONE  FF until command done
  2227.  
  2228.  
  2229.  
  2230.  
  2231.  
  2232.  
  2233.  
  2234.  
  2235.  
  2236.  
  2237.  
  2238.  
  2239.                                        29
  2240.  
  2241.  
  2242.  
  2243.  
  2244.  
  2245.  
  2246.  
  2247.  
  2248.  
  2249.                                 DATAGRAM COMMANDS
  2250.  
  2251.         Datagrams provide a means to transfer data between 
  2252.         processes without using the session mechanism.  Messages may be 
  2253.         sent to a given name, a group name, or to all processes.  
  2254.         Datagram messages do not provide the same reliability as session data 
  2255.         transfer, since the sender will not be notified when messages are 
  2256.         undeliverable.
  2257.  
  2258.         Datagram commands are:
  2259.  
  2260.                   -    Send Datagram
  2261.                   -    Receive Datagram
  2262.                   -    Send Broadcast
  2263.                   -    Receive Broadcast
  2264.  
  2265.         These commands are described below.  For each command, the 
  2266.         required NCB fields are listed. 
  2267.  
  2268.                               Send Datagram Command
  2269.  
  2270.         Use this command to send a datagram message.  The Net Bios 
  2271.         does not detect whether the message was successfully 
  2272.         delivered.  
  2273.  
  2274.  
  2275.         NCB FIELDS SET:   
  2276.  
  2277.              FIELD     DESCRIPTION          
  2278.  
  2279.              COMMAND   020h (Wait mode), 0A0h (No-wait mode)
  2280.              LANA_NUM  Specifies which LANA the command is addressing      
  2281.              NUM       Local name number
  2282.              CALLNAME  Destination name (may be a group name.)
  2283.              BUFADR    Address
  2284.              BUFLEN    Length of the message. 512 bytes maximum 
  2285.              POST      Used in no-wait mode only, 
  2286.                        Contains address of post routine or 0:0 
  2287.  
  2288.  
  2289.         NCB FIELDS RETURNED:
  2290.  
  2291.              FIELD     DESCRIPTION          
  2292.  
  2293.              RETCODE   Error code or 0 if no error.
  2294.              CMD_DONE  FF until command done
  2295.  
  2296.  
  2297.  
  2298.  
  2299.  
  2300.  
  2301.  
  2302.  
  2303.  
  2304.  
  2305.                                        30
  2306.  
  2307.  
  2308.  
  2309.  
  2310.  
  2311.  
  2312.  
  2313.  
  2314.  
  2315.                             Receive Datagram Command
  2316.  
  2317.         Use this command to wait for a SEND DATAGRAM to the name associated 
  2318.         with the NUM field.  There is no time-out on this command.  If 
  2319.         the maximum buffer length was smaller than the length of the 
  2320.         data, then the buffer is filled to the maximum and RETCODE = 06h 
  2321.         is returned.  The remaining data is lost. 
  2322.  
  2323.  
  2324.         NCB FIELDS SET:   
  2325.  
  2326.              FIELD     DESCRIPTION          
  2327.  
  2328.              COMMAND   021h (Wait mode), 0A1h (No-wait mode)
  2329.              LANA_NUM  Specifies which LANA the command is addressing      
  2330.              BUFADR    Address of receive data buffer
  2331.              BUFLEN    Maximum length of receive data buffer
  2332.              NUM       Name, may be a group name 
  2333.                        or 0FFh to receive all datagrams to the machine. 
  2334.              POST      Used in no-wait mode only, 
  2335.                        Contains address of post routine or 0:0 
  2336.  
  2337.  
  2338.         NCB FIELDS RETURNED:
  2339.  
  2340.              FIELD     DESCRIPTION          
  2341.  
  2342.              CALLNAME  The name of the sender 
  2343.              BUFLEN    The actual size of the received data 
  2344.              RETCODE   Error code or 0 if no error.
  2345.              CMD_DONE  FF until command done
  2346.  
  2347.  
  2348.  
  2349.  
  2350.  
  2351.  
  2352.  
  2353.  
  2354.  
  2355.  
  2356.  
  2357.  
  2358.  
  2359.  
  2360.  
  2361.  
  2362.  
  2363.  
  2364.  
  2365.  
  2366.  
  2367.  
  2368.  
  2369.  
  2370.  
  2371.                                        31
  2372.  
  2373.  
  2374.  
  2375.  
  2376.  
  2377.  
  2378.  
  2379.  
  2380.                              Send Broadcast Command
  2381.  
  2382.         Use this command to send a broadcast message.  The Net Bios 
  2383.         does not detect whether the message was successfully 
  2384.         delivered.  
  2385.  
  2386.         Each SEND BROADCAST satisfies all outstanding RECEIVE BROADCAST 
  2387.         commands on the network.
  2388.  
  2389.  
  2390.         NCB FIELDS SET:   
  2391.  
  2392.              FIELD     DESCRIPTION          
  2393.  
  2394.              COMMAND   022h (Wait mode), 0A2h (No-wait mode)
  2395.              LANA_NUM  Specifies which LANA the command is addressing      
  2396.              NUM       Local name number
  2397.              BUFADR    Address of buffer 
  2398.              BUFLEN    Length of the message, 512 bytes maximum  
  2399.              POST      Used in no-wait mode only, 
  2400.                        Contains address of post routine or 0:0 
  2401.  
  2402.  
  2403.         NCB FIELDS RETURNED:
  2404.  
  2405.              FIELD     DESCRIPTION          
  2406.  
  2407.              RETCODE   Error code or 0 if no error.
  2408.              CMD_DONE  FF until command done
  2409.  
  2410.  
  2411.  
  2412.  
  2413.  
  2414.  
  2415.  
  2416.  
  2417.  
  2418.  
  2419.  
  2420.  
  2421.  
  2422.  
  2423.  
  2424.  
  2425.  
  2426.  
  2427.  
  2428.  
  2429.  
  2430.  
  2431.  
  2432.  
  2433.  
  2434.  
  2435.  
  2436.  
  2437.                                        32
  2438.  
  2439.  
  2440.  
  2441.  
  2442.  
  2443.  
  2444.  
  2445.  
  2446.  
  2447.                             Receive Broadcast Command
  2448.  
  2449.         Use this command to wait for a SEND BROADCAST message.  There is no 
  2450.         time-out on this command.  
  2451.  
  2452.         Each SEND BROADCAST satisfies all outstanding RECEIVE BROADCAST 
  2453.         commands on the network.
  2454.  
  2455.         If the maximum buffer length was smaller than the length of the 
  2456.         data, then the buffer is filled to the maximum and RETCODE = 06h 
  2457.         is returned.  The remaining data is lost. 
  2458.  
  2459.  
  2460.         NCB FIELDS SET:   
  2461.  
  2462.              FIELD     DESCRIPTION          
  2463.  
  2464.              COMMAND   023h (Wait mode), 0A3h (No-wait mode)
  2465.              LANA_NUM  Specifies which LANA the command is addressing      
  2466.              NUM       Valid name number
  2467.              BUFADR    Address of receive data buffer
  2468.              BUFLEN    Size of receive data buffer
  2469.              POST      Used in no-wait mode only, 
  2470.                        Contains address of post routine or 0:0 
  2471.  
  2472.  
  2473.         NCB FIELDS RETURNED:
  2474.  
  2475.              FIELD     DESCRIPTION          
  2476.  
  2477.              CALLNAME  Name of the sender 
  2478.              BUFLEN    Actual size of the received data
  2479.              RETCODE   Error code or 0 if no error.
  2480.              CMD_DONE  FF until command done
  2481.  
  2482.  
  2483.  
  2484.  
  2485.  
  2486.  
  2487.  
  2488.  
  2489.  
  2490.  
  2491.  
  2492.  
  2493.  
  2494.  
  2495.  
  2496.  
  2497.  
  2498.  
  2499.  
  2500.  
  2501.  
  2502.  
  2503.                                        33
  2504.  
  2505.  
  2506.  
  2507.  
  2508.  
  2509.  
  2510.  
  2511.  
  2512.         APPENDIX A
  2513.                             Net Bios Command Summary
  2514.  
  2515.  
  2516.            Command           Wait   No Wait                              
  2517.            Name              Code    Code     Description
  2518.  
  2519.         General Commands
  2520.                                
  2521.            RESET               32     --      Reset Net Bios.                    
  2522.            CANCEL              35     --      Cancel a pending command.          
  2523.            ADAPTER STATUS      33     B3      Get status of a Net Bios.          
  2524.            UNLINK              70     --      Cancel boot redirection.           
  2525.  
  2526.  
  2527.         Name Commands                           
  2528.  
  2529.            ADD NAME            30    B0    Add unique name to name table.     
  2530.            ADD GROUP NAME      36    B6    Add non-unique name to table.      
  2531.            DELETE NAME         31    B1    Delete name from name table.       
  2532.  
  2533.         Session Control Commands                      
  2534.  
  2535.            CALL                10    90    Establish session with another.    
  2536.            LISTEN              11    91    Wait for a CALL from another.      
  2537.            HANG UP             12    92    Close session.                     
  2538.            SESSION STATUS      34    B4    Status of sessions under name.     
  2539.  
  2540.         Session Data Transfer Commands                   
  2541.  
  2542.            SEND                14    94    Send session data.                 
  2543.            CHAIN SEND          17    97    Concatenate and send two buffers.  
  2544.            RECEIVE             15    95    Receive session data.              
  2545.            RECEIVE ANY         16    96    Receive data from any session      
  2546.                                            under specified name.              
  2547.  
  2548.         Datagram Commands                         
  2549.  
  2550.            SEND DATAGRAM       20    A0    Send data, addressed by name.      
  2551.            RECEIVE DATAGRAM    21    A1    Receive datagram to name.          
  2552.            SEND BROADCAST      22    A2    Send data to all stations.         
  2553.            RECEIVE BROADCAST   23    A3    Enable receive of next broadcast.  
  2554.  
  2555.  
  2556.  
  2557.  
  2558.  
  2559.  
  2560.  
  2561.  
  2562.  
  2563.  
  2564.  
  2565.  
  2566.  
  2567.  
  2568.  
  2569.                                  A-1
  2570.  
  2571.  
  2572.  
  2573.  
  2574.  
  2575.  
  2576.  
  2577.  
  2578.         APPENDIX B
  2579.                        Net Bios Control Block (NCB) Format
  2580.  
  2581.           Off-  Size     Field                           
  2582.           set   Bytes    Name      Field Description 
  2583.          (Hex)  (Dec)
  2584.          
  2585.             0     1     COMMAND    Net Bios command code.  High order bit     
  2586.                                    set indicates no-wait mode.                
  2587.  
  2588.             1     1     RETCODE    Completion result.  Zero if no error.      
  2589.  
  2590.             2     1     LSN        Local session number (1 to 254). Returned  
  2591.                                    by CALL and LISTEN, and supplied for       
  2592.                                    SEND and RECEIVE commands.                 
  2593.  
  2594.             3     1     NUM        Name Number (1 to 254). Returned by ADD    
  2595.                                    NAME commands, and supplied for RECEIVE    
  2596.                                    ANY and datagram commands.                 
  2597.  
  2598.             4     4     BUFADR     Address of message for send and receive.   
  2599.  
  2600.             8     2     BUFLEN     Length of message buffer. For receive      
  2601.                                    commands, supply the maximum buffer size   
  2602.                                    and the actual length is returned.         
  2603.  
  2604.            0A    16     CALLNAME   Name from/of remote machine for CALL,      
  2605.                                    LISTEN and datagrams.  For a CHAIN SEND    
  2606.                                    command, the first word specifies the      
  2607.                                    length of the second buffer, and the       
  2608.                                    next two words specify the address.        
  2609.  
  2610.            1A    16     NAME       Local name. Specifies name to add for ADD  
  2611.                                    NAME, or name to use for other commands.   
  2612.  
  2613.            2A     1     RTO        Receive time-out in .5 second increments.  
  2614.                                    Supplied on CALL and LISTEN commands.      
  2615.  
  2616.            2B     1     STO        Send time-out in .5 second increments.     
  2617.                                    Supplied on CALL and LISTEN commands.      
  2618.  
  2619.            2C     4     POST       Address of user interrupt routine called   
  2620.                                    when command completes and no-wait mode    
  2621.                                    mode was specified in command code. Not    
  2622.                                    called if set to 0:0.                      
  2623.  
  2624.            30     1     LANA_NUM   Number of adapter card -- 0 for the first  
  2625.                                    and 1 for the second, if applicable.       
  2626.  
  2627.            31     1     CMD_DONE   Command completed flag. A value of 0FFH    
  2628.                                    indicates the command has not completed.   
  2629.                                    When the command has completed, CMD_DONE   
  2630.                                    is set to same value as RETCODE.           
  2631.  
  2632.            32    14     RES        Used internally by Net Bios.               
  2633.  
  2634.  
  2635.                                  B-1
  2636.  
  2637.  
  2638.  
  2639.  
  2640.  
  2641.  
  2642.  
  2643.  
  2644.  
  2645.  
  2646.                          NCB Field Input/Output Summary
  2647.         ^[Z^\^[D^\^[D^\^[D^\^[D^\^[D^\^[D^\^[D^\^[D^\^[D^\^[D^\^[D^\^[D^\^[D^\^[D^\^[D^\^[B^\^[D^\^[D^\^[D^\^[B^\^[D^\^[D^\^[D^\^[B^\^[D^\^[D^\^[D^\^[B^\^[D^\^[D^\^[D^\^[B^\^[D^\^[D^\^[D^\^[B^\^[D^\^[D^\^[D^\^[B^\^[D^\^[D^\^[D^\^[B^\^[D^\^[D^\^[D^\^[B^\^[D^\^[D^\^[D^\^[B^\^[D^\^[D^\^[D^\^[B^\^[D^\^[D^\^[D^\^[B^\^[D^\^[D^\^[D^\^[?^\
  2648.         ^[3^\               ^[3^\ C ^[3^\ R ^[3^\ L ^[3^\ N ^[3^\ B ^[3^\ B ^[3^\ C ^[3^\ N ^[3^\ R ^[3^\ P ^[3^\ L ^[3^\ C ^[3^\
  2649.         ^[3^\               ^[3^\ O ^[3^\ E ^[3^\ S ^[3^\ U ^[3^\ U ^[3^\ U ^[3^\ A ^[3^\ A ^[3^\ T ^[3^\ O ^[3^\ A ^[3^\ M ^[3^\
  2650.         ^[3^\               ^[3^\ M ^[3^\ T ^[3^\ N ^[3^\ M ^[3^\ F ^[3^\ F ^[3^\ L ^[3^\ M ^[3^\ O ^[3^\ S ^[3^\ N ^[3^\ D ^[3^\
  2651.         ^[3^\               ^[3^\ M ^[3^\ C ^[3^\   ^[3^\   ^[3^\ A ^[3^\ L ^[3^\ L ^[3^\ E ^[3^\ & ^[3^\ T ^[3^\ A ^[3^\ _ ^[3^\
  2652.         ^[3^\               ^[3^\ A ^[3^\ O ^[3^\   ^[3^\   ^[3^\ D ^[3^\ E ^[3^\ N ^[3^\   ^[3^\ S ^[3^\   ^[3^\ _ ^[3^\ D ^[3^\
  2653.         ^[3^\               ^[3^\ N ^[3^\ D ^[3^\   ^[3^\   ^[3^\ R ^[3^\ N ^[3^\ A ^[3^\   ^[3^\ T ^[3^\   ^[3^\ N ^[3^\ O ^[3^\
  2654.         ^[3^\               ^[3^\ D ^[3^\ E ^[3^\   ^[3^\   ^[3^\   ^[3^\   ^[3^\ M ^[3^\   ^[3^\ O ^[3^\   ^[3^\ U ^[3^\ N ^[3^\
  2655.         ^[3^\               ^[3^\   ^[3^\   ^[3^\   ^[3^\   ^[3^\   ^[3^\   ^[3^\ E ^[3^\   ^[3^\   ^[3^\   ^[3^\ M ^[3^\ E ^[3^\
  2656.         ^[3^\               ^[3^\   ^[3^\   ^[3^\   ^[3^\   ^[3^\   ^[3^\   ^[3^\   ^[3^\   ^[3^\   ^[3^\   ^[3^\   ^[3^\   ^[3^\
  2657.         ^[3^\    Command    ^[3^\   ^[3^\   ^[3^\   ^[3^\   ^[3^\BUF^[3^\BUF^[3^\CAL^[3^\   ^[3^\RTO^[3^\   ^[3^\LAN^[3^\CMD^[3^\
  2658.         ^[3^\      Name     ^[3^\CMD^[3^\RET^[3^\LSN^[3^\NUM^[3^\ADR^[3^\LEN^[3^\NAM^[3^\NAM^[3^\STO^[3^\PST^[3^\NUM^[3^\DON^[3^\
  2659.         ^[C^\^[D^\^[D^\^[D^\^[D^\^[D^\^[D^\^[D^\^[D^\^[D^\^[D^\^[D^\^[D^\^[D^\^[D^\^[D^\^[E^\^[D^\^[D^\^[D^\^[E^\^[D^\^[D^\^[D^\^[E^\^[D^\^[D^\^[D^\^[E^\^[D^\^[D^\^[D^\^[E^\^[D^\^[D^\^[D^\^[E^\^[D^\^[D^\^[D^\^[E^\^[D^\^[D^\^[D^\^[E^\^[D^\^[D^\^[D^\^[E^\^[D^\^[D^\^[D^\^[E^\^[D^\^[D^\^[D^\^[E^\^[D^\^[D^\^[D^\^[E^\^[D^\^[D^\^[D^\^[4^\
  2660.         ^[3^\RESET          ^[3^\ I ^[3^\ O ^[3^\ I ^[3^\ I ^[3^\ - ^[3^\ - ^[3^\ - ^[3^\ - ^[3^\ - ^[3^\ - ^[3^\ I ^[3^\ O ^[3^\
  2661.         ^[3^\CANCEL         ^[3^\ I ^[3^\ O ^[3^\ - ^[3^\ - ^[3^\ I ^[3^\ - ^[3^\ - ^[3^\ - ^[3^\ - ^[3^\ - ^[3^\ I ^[3^\ O ^[3^\
  2662.         ^[3^\ADAPTER STATUS ^[3^\ I ^[3^\ O ^[3^\ - ^[3^\ - ^[3^\ I ^[3^\I/O^[3^\ I ^[3^\ - ^[3^\ - ^[3^\ I ^[3^\ I ^[3^\ O ^[3^\
  2663.         ^[3^\UNLINK         ^[3^\ I ^[3^\ O ^[3^\ - ^[3^\ - ^[3^\ - ^[3^\ - ^[3^\ - ^[3^\ - ^[3^\ - ^[3^\ - ^[3^\ I ^[3^\ O ^[3^\
  2664.         ^[C^\^[D^\^[D^\^[D^\^[D^\^[D^\^[D^\^[D^\^[D^\^[D^\^[D^\^[D^\^[D^\^[D^\^[D^\^[D^\^[E^\^[D^\^[D^\^[D^\^[E^\^[D^\^[D^\^[D^\^[E^\^[D^\^[D^\^[D^\^[E^\^[D^\^[D^\^[D^\^[E^\^[D^\^[D^\^[D^\^[E^\^[D^\^[D^\^[D^\^[E^\^[D^\^[D^\^[D^\^[E^\^[D^\^[D^\^[D^\^[E^\^[D^\^[D^\^[D^\^[E^\^[D^\^[D^\^[D^\^[E^\^[D^\^[D^\^[D^\^[E^\^[D^\^[D^\^[D^\^[4^\
  2665.         ^[3^\ADD NAME       ^[3^\ I ^[3^\ O ^[3^\ - ^[3^\ O ^[3^\ - ^[3^\ - ^[3^\ - ^[3^\ I ^[3^\ - ^[3^\ I ^[3^\ I ^[3^\ O ^[3^\
  2666.         ^[3^\ADD GROUP NAME ^[3^\ I ^[3^\ O ^[3^\ - ^[3^\ O ^[3^\ - ^[3^\ - ^[3^\ - ^[3^\ I ^[3^\ - ^[3^\ I ^[3^\ I ^[3^\ O ^[3^\
  2667.         ^[3^\DELETE NAME    ^[3^\ I ^[3^\ O ^[3^\ - ^[3^\ - ^[3^\ - ^[3^\ - ^[3^\ - ^[3^\ I ^[3^\ - ^[3^\ I ^[3^\ I ^[3^\ O ^[3^\
  2668.         ^[C^\^[D^\^[D^\^[D^\^[D^\^[D^\^[D^\^[D^\^[D^\^[D^\^[D^\^[D^\^[D^\^[D^\^[D^\^[D^\^[E^\^[D^\^[D^\^[D^\^[E^\^[D^\^[D^\^[D^\^[E^\^[D^\^[D^\^[D^\^[E^\^[D^\^[D^\^[D^\^[E^\^[D^\^[D^\^[D^\^[E^\^[D^\^[D^\^[D^\^[E^\^[D^\^[D^\^[D^\^[E^\^[D^\^[D^\^[D^\^[E^\^[D^\^[D^\^[D^\^[E^\^[D^\^[D^\^[D^\^[E^\^[D^\^[D^\^[D^\^[E^\^[D^\^[D^\^[D^\^[4^\
  2669.         ^[3^\CALL           ^[3^\ I ^[3^\ O ^[3^\ O ^[3^\ - ^[3^\ - ^[3^\ - ^[3^\ I ^[3^\ I ^[3^\ I ^[3^\ I ^[3^\ I ^[3^\ O ^[3^\
  2670.         ^[3^\LISTEN         ^[3^\ I ^[3^\ O ^[3^\ O ^[3^\ - ^[3^\ - ^[3^\ - ^[3^\I/O^[3^\ I ^[3^\ I ^[3^\ I ^[3^\ I ^[3^\ O ^[3^\
  2671.         ^[3^\HANG UP        ^[3^\ I ^[3^\ O ^[3^\ I ^[3^\ - ^[3^\ - ^[3^\ - ^[3^\ - ^[3^\ - ^[3^\ - ^[3^\ I ^[3^\ I ^[3^\ O ^[3^\
  2672.         ^[3^\SESSION STATUS ^[3^\ I ^[3^\ O ^[3^\ - ^[3^\ - ^[3^\ I ^[3^\I/O^[3^\ - ^[3^\ I ^[3^\ - ^[3^\ I ^[3^\ I ^[3^\ O ^[3^\
  2673.         ^[C^\^[D^\^[D^\^[D^\^[D^\^[D^\^[D^\^[D^\^[D^\^[D^\^[D^\^[D^\^[D^\^[D^\^[D^\^[D^\^[E^\^[D^\^[D^\^[D^\^[E^\^[D^\^[D^\^[D^\^[E^\^[D^\^[D^\^[D^\^[E^\^[D^\^[D^\^[D^\^[E^\^[D^\^[D^\^[D^\^[E^\^[D^\^[D^\^[D^\^[E^\^[D^\^[D^\^[D^\^[E^\^[D^\^[D^\^[D^\^[E^\^[D^\^[D^\^[D^\^[E^\^[D^\^[D^\^[D^\^[E^\^[D^\^[D^\^[D^\^[E^\^[D^\^[D^\^[D^\^[4^\
  2674.         ^[3^\SEND           ^[3^\ I ^[3^\ O ^[3^\ I ^[3^\ - ^[3^\ I ^[3^\ I ^[3^\ - ^[3^\ - ^[3^\ - ^[3^\ I ^[3^\ I ^[3^\ O ^[3^\
  2675.         ^[3^\CHAIN SEND     ^[3^\ I ^[3^\ O ^[3^\ I ^[3^\ - ^[3^\ I ^[3^\ I ^[3^\ I ^[3^\ - ^[3^\ - ^[3^\ I ^[3^\ I ^[3^\ O ^[3^\
  2676.         ^[3^\RECEIVE        ^[3^\ I ^[3^\ O ^[3^\ I ^[3^\ - ^[3^\ I ^[3^\I/O^[3^\ - ^[3^\ - ^[3^\ - ^[3^\ I ^[3^\ I ^[3^\ O ^[3^\
  2677.         ^[3^\RECEIVE ANY    ^[3^\ I ^[3^\ O ^[3^\ O ^[3^\ I ^[3^\ I ^[3^\I/O^[3^\ - ^[3^\ - ^[3^\ - ^[3^\ I ^[3^\ I ^[3^\ O ^[3^\
  2678.         ^[C^\^[D^\^[D^\^[D^\^[D^\^[D^\^[D^\^[D^\^[D^\^[D^\^[D^\^[D^\^[D^\^[D^\^[D^\^[D^\^[E^\^[D^\^[D^\^[D^\^[E^\^[D^\^[D^\^[D^\^[E^\^[D^\^[D^\^[D^\^[E^\^[D^\^[D^\^[D^\^[E^\^[D^\^[D^\^[D^\^[E^\^[D^\^[D^\^[D^\^[E^\^[D^\^[D^\^[D^\^[E^\^[D^\^[D^\^[D^\^[E^\^[D^\^[D^\^[D^\^[E^\^[D^\^[D^\^[D^\^[E^\^[D^\^[D^\^[D^\^[E^\^[D^\^[D^\^[D^\^[4^\
  2679.         ^[3^\SEND DATAGRAM  ^[3^\ I ^[3^\ O ^[3^\ - ^[3^\ I ^[3^\ I ^[3^\ I ^[3^\ I ^[3^\ - ^[3^\ - ^[3^\ I ^[3^\ I ^[3^\ O ^[3^\
  2680.         ^[3^\RECV DATAGRAM  ^[3^\ I ^[3^\ O ^[3^\ - ^[3^\ I ^[3^\ I ^[3^\I/O^[3^\ O ^[3^\ - ^[3^\ - ^[3^\ I ^[3^\ I ^[3^\ O ^[3^\
  2681.         ^[3^\SEND BROADCAST ^[3^\ I ^[3^\ O ^[3^\ - ^[3^\ I ^[3^\ I ^[3^\ I ^[3^\ - ^[3^\ - ^[3^\ - ^[3^\ I ^[3^\ I ^[3^\ O ^[3^\
  2682.         ^[3^\RECV BROADCAST ^[3^\ I ^[3^\ O ^[3^\ - ^[3^\ I ^[3^\ I ^[3^\I/O^[3^\ O ^[3^\ - ^[3^\ - ^[3^\ I ^[3^\ I ^[3^\ O ^[3^\
  2683.         ^[@^\^[D^\^[D^\^[D^\^[D^\^[D^\^[D^\^[D^\^[D^\^[D^\^[D^\^[D^\^[D^\^[D^\^[D^\^[D^\^[A^\^[D^\^[D^\^[D^\^[A^\^[D^\^[D^\^[D^\^[A^\^[D^\^[D^\^[D^\^[A^\^[D^\^[D^\^[D^\^[A^\^[D^\^[D^\^[D^\^[A^\^[D^\^[D^\^[D^\^[A^\^[D^\^[D^\^[D^\^[A^\^[D^\^[D^\^[D^\^[A^\^[D^\^[D^\^[D^\^[A^\^[D^\^[D^\^[D^\^[A^\^[D^\^[D^\^[D^\^[A^\^[D^\^[D^\^[D^\^[Y^\
  2684.  
  2685.              Legend
  2686.                 I  =  Field is input (passed to Net Bios)
  2687.                 O  =  Field is output (returned by Net Bios)
  2688.                I/O =  Field is used for both input and output
  2689.  
  2690.  
  2691.  
  2692.  
  2693.  
  2694.  
  2695.  
  2696.  
  2697.  
  2698.  
  2699.  
  2700.  
  2701.                                  B-2
  2702.  
  2703.  
  2704.  
  2705.  
  2706.  
  2707.  
  2708.  
  2709.  
  2710.         APPENDIX C
  2711.                          NET BIOS ERROR CODE LISTING
  2712.  
  2713.           Code   Description                           
  2714.  
  2715.            00    No error.                                               
  2716.  
  2717.            01    Illegal buffer length.  A SEND BROADCAST or SEND        
  2718.                  DATAGRAM command specified a length greater than 512    
  2719.                  bytes, or a status command specified a buffer length    
  2720.                  smaller than minimum allowed.                           
  2721.  
  2722.            03    Invalid command.                                        
  2723.  
  2724.            05    Time out.  For SEND, RECEIVE, and HANG UP commands, the 
  2725.                  time-out specified when the session was established has 
  2726.                  elapsed.  For a CALL or ADAPTER STATUS command, an      
  2727.                  internal timer expired.                                 
  2728.  
  2729.            06    Message Incomplete.  The buffer size specified in the   
  2730.                  NCB was not large enough to hold the receive data. For  
  2731.                  RECEIVE or RECEIVE ANY commands, the next command will  
  2732.                  get the rest of the data.  For other commands, the      
  2733.                  remaining data is lost.                                 
  2734.  
  2735.            08    Invalid local session number (LSN).                     
  2736.  
  2737.            09    Out of resources.  The Net Bios is out of some internal 
  2738.                  resource, such as buffers.  Delay and reissue the       
  2739.                  command.                                                
  2740.  
  2741.            0A    Session closed.  For a SEND, RECEIVE, RECEIVE ANY, or   
  2742.                  HANG UP, this indicates that the session was terminated 
  2743.                  by the remote computer.                                 
  2744.  
  2745.            0B    Command canceled.  Command execution of the NCB was     
  2746.                  aborted by the CANCEL command.                          
  2747.  
  2748.            0D    Duplicate local name.  An ADD NAME command specified    
  2749.                  an existing name.                                       
  2750.  
  2751.            0E    Name table full.                                        
  2752.  
  2753.            0F    DELETE NAME completed, but name has active sessions     
  2754.                  (name will be deleted when all sessions closed).        
  2755.  
  2756.            11    Local session table full.                               
  2757.  
  2758.            12    Remote computer not listening.  On a CALL, the remote   
  2759.                  computer was found, but had no outstanding LISTEN for   
  2760.                  the CALL.                                               
  2761.  
  2762.            13    Invalid name number.                                    
  2763.  
  2764.            14    Name not found.                                         
  2765.  
  2766.  
  2767.                                  C-1
  2768.  
  2769.  
  2770.  
  2771.  
  2772.  
  2773.  
  2774.  
  2775.  
  2776.                           NET BIOS ERROR CODE LISTING (cont.)
  2777.  
  2778.           Code   Description                           
  2779.  
  2780.            15    Name not found or "*" or 00h in first byte of remote    
  2781.                  name field on a CALL.                                   
  2782.  
  2783.            16    Name already exists on network.                         
  2784.  
  2785.            17    Name was deleted.                                       
  2786.  
  2787.            18    Session terminated abnormally.  Connection with the     
  2788.                  remote computer was lost.                               
  2789.  
  2790.            19    Name conflict.  Two computers using the same name was   
  2791.                  detected.                                               
  2792.  
  2793.            21    Interface busy.  The Net Bios cannot execute because    
  2794.                  it was called from an interrupt handler.                
  2795.  
  2796.            22    Too many commands issued.                               
  2797.  
  2798.            23    Invalid LAN adapter (LANA) number.                      
  2799.  
  2800.            24    Command completed before canceled.  Returned in CANCEL  
  2801.                  NCB when target command completed normally.             
  2802.  
  2803.            26    Invalid cancel command.  The target NCB could not be    
  2804.                  found.                                                  
  2805.  
  2806.          40-FE   Hardware error.                                         
  2807.  
  2808.            FF    Indicates the command has not completed.                
  2809.  
  2810.  
  2811.  
  2812.  
  2813.  
  2814.  
  2815.  
  2816.  
  2817.  
  2818.  
  2819.  
  2820.  
  2821.  
  2822.  
  2823.  
  2824.  
  2825.  
  2826.  
  2827.  
  2828.  
  2829.  
  2830.  
  2831.  
  2832.  
  2833.                                  C-2
  2834.  
  2835.  
  2836.  
  2837.  
  2838.  
  2839.